<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue路由6</title>
    <script src="../../js/vue3.js"></script>
    <script src="../../js/vue-router.global.js"></script>
    <style>
        #app {
            margin: 5rem auto;
            width: 35%;
        }
        
        * {
            padding: 0;
            margin: 0;
        }
        
        .box {
            border: 1px gray solid;
        }
        
        .row {
            display: flex;
            justify-content: space-around;
        }
        
        .tap {
            width: 50%;
            background-color: lightgray;
            border: 1px gray solid;
            font-size: 1.2rem;
            text-align: center;
            padding: 1rem;
        }
        
        .contents {
            height: 7rem;
            padding: 1rem;
            font-size: 1.5rem;
        }
        
      
    </style>
</head>

<body>
    <!-- 运行 -->
    <div id="app">
        <div class="box">
            <div class="row">
                <div class="tap">
                    <router-view name="left"></router-view>
                </div>
               <div class="tap">
                <router-view name="right"></router-view>
               </div>
                
            </div>
            <div class="contents">
                <router-view></router-view>
            </div>
        </div>

    </div>
    <!-- 模版 -->
    <template id="left">
        <p>我应该是左边</p>
    </template>
    <template id="right">
        <p>我可能是右边</p>
    </template>
    <template id="body">
       <p>我大概是身体</p>
    </template>
    <script>
        const v_app = Vue.createApp({
            data() {
                return {

                }
            },
        });
        const left = {
            template: "#left",
        }
        const right = {
            template: "#right",
        }
        const body = {
            template: "#body",
        }
        const routes = [{
            path: "/",
            components: {
                'default':body,
                'left':left,
                'right':right
            },
        
        }]
        const router = VueRouter.createRouter({
            history: VueRouter.createWebHashHistory(),
            routes: routes
        });
        v_app.use(router);
        v_app.mount("#app");
    </script>
</body>

</html>